var o, e = require, t = module, n = exports, i = this && this.__extends || (o = function(t, e) {
    return (o = Object.setPrototypeOf || {
        __proto__: []
    } instanceof Array && function(t, e) {
        t.__proto__ = e;
    } || function(t, e) {
        for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
    })(t, e);
}, function(t, e) {
    function n() {
        this.constructor = t;
    }
    o(t, e), t.prototype = null === e ? Object.create(e) : (n.prototype = e.prototype, 
    new n());
}), a = this && this.__decorate || function(t, e, n, i) {
    var o, s = arguments.length, a = s < 3 ? e : null === i ? i = Object.getOwnPropertyDescriptor(e, n) : i;
    if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) a = Reflect.decorate(t, e, n, i); else for (var c = t.length - 1; 0 <= c; c--) (o = t[c]) && (a = (s < 3 ? o(a) : 3 < s ? o(e, n, a) : o(e, n)) || a);
    return 3 < s && a && Object.defineProperty(e, n, a), a;
};

Object.defineProperty(n, "__esModule", {
    value: !0
});

var r = e("AudioManager"), s = e("GameManager"), c = e("GameStartAnimation"), l = e("GameData"), d = cc._decorator, u = d.ccclass, p = d.property, h = function(e) {
    function t() {
        var t = null !== e && e.apply(this, arguments) || this;
        return t.gamView = null, t.animation = null, t.startSkeleton = null, t.endSkeleton = null, 
        t;
    }
    return i(t, e), t.prototype.start = function() {}, t.prototype.startGame = function() {
        var t = this;
        s.default.getInstance().matchType == s.MatchType.三对三 ? (this.switchActive(this.animation.node, !0), 
        this.switchActive(this.startSkeleton.node, !1), this.switchActive(this.endSkeleton.node, !1), 
        this.scheduleOnce(function() {
            r.default.getInstance().playAudio("对战开始游戏");
        }, 1.1), this.animation.init(), this.animation.doEffect(), this.scheduleOnce(function() {
            t.node.active = !1, s.default.getInstance().startGame();
        }, 4)) : (this.switchActive(this.animation.node, !1), this.switchActive(this.startSkeleton.node, !0), 
        this.switchActive(this.endSkeleton.node, !1), this.startSkeleton.setEventListener(function() {
            l.GD.isEffect && r.default.getInstance().playAudio("开始游戏的填弹音效");
        }), this.startSkeleton.setCompleteListener(function() {
            t.startSkeleton.setAnimation(0, "animation2", !1), t.startSkeleton.setCompleteListener(function() {
                t.startSkeleton.setCompleteListener(null), t.startSkeleton.node.active = !1;
            });
        }), this.startSkeleton.setAnimation(0, "animation", !1), this.scheduleOnce(function() {
            t.node.active = !1, s.default.getInstance().startGame();
        }, 3));
    }, t.prototype.endGame = function() {
        var t = this;
        this.switchActive(this.animation.node, !1), this.switchActive(this.startSkeleton.node, !1), 
        this.switchActive(this.endSkeleton.node, !0), this.endSkeleton.setCompleteListener(function() {
            t.endSkeleton.setAnimation(0, "animation2", !1), t.endSkeleton.setCompleteListener(function() {
                t.endSkeleton.setCompleteListener(null), t.endSkeleton.node.active = !1;
            });
        }), this.endSkeleton.setAnimation(0, "animation", !1), this.scheduleOnce(function() {
            t.node.active = !1, s.default.getInstance().accountGame();
        }, 3);
    }, t.prototype.switchActive = function(t, e) {
        t.active != e && (t.active = e);
    }, a([ p(c.default) ], t.prototype, "animation", void 0), a([ p(sp.Skeleton) ], t.prototype, "startSkeleton", void 0), 
    a([ p(sp.Skeleton) ], t.prototype, "endSkeleton", void 0), a([ u ], t);
}(cc.Component);

n.default = h;